<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改班级信息')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-clazz-edit" th:object="${clazz}">
        <input name="clazzId" th:field="*{clazzId}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">班级名称：</label>
            <div class="col-sm-8">
                <input name="clazzName" th:field="*{clazzName}" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">学院：</label>
            <div class="col-sm-8">
                <select class="form-control m-b" name="clazzCollege" th:with="type=${@dict.getType('cws_college_name')}"
                        required>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                            th:attr="selected=(${clazz.clazzCollege} eq ${dict.dictValue} ? true: false)"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">专业：</label>
            <div class="col-sm-8">
                <select class="form-control m-b" name="clazzMajor" th:with="type=${@dict.getType('cws_major_name')}"
                        required>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                            th:attr="selected=(${clazz.clazzMajor} == ${dict.dictValue} ? true: false)"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">年级：</label>
            <div class="col-sm-8">
                <select class="form-control m-b" name="clazzGrade" th:with="type=${@dict.getType('cws_grade_value')}"
                        required>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                            th:attr="selected=(${clazz.clazzGrade} == ${dict.dictValue} ? true: false)"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">辅导员：</label>
            <div class="col-sm-8">
                <select class="form-control m-b" name="userId" required>
                    <option th:each="instructor : ${instructors}" th:text="${instructor.userName}"
                            th:value="${instructor.userId}"
                            th:attr="selected=(${clazz.userId} == ${instructor.userId} ? true: false)">
                    </option>
                </select>
            </div>
        </div>
        <h4 class="form-header h4">其他信息</h4>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
            </div>
        </div>
    </form>
</div>
<div class="row">
    <div class="col-sm-offset-5 col-sm-10">
        <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
        <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "cws/clazz";
    $("#form-clazz-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-clazz-edit').serialize());
        }
    }
</script>
</body>
</html>